package com.shrio.service;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by luojie on 2018/3/27.
 */
@Service
public class MQProducerImpl implements IMQProducer {

    @Autowired
    private AmqpTemplate amqpTemplate;

    final String queue_key = "test_queue_key";

    @Override
    public void sendDataToQueue(String queueKey, Object object) {
        try {
            amqpTemplate.convertAndSend(queueKey, object);
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}
